package com.yzy.controller;
/**
* @description: 
* @author yangzhenyu
* @date 2022/5/16 17:57
* @version 1.0
*/
public class Test {
    public static String setSquence(int val,int num) {
        String r = "";
        String nos = String.valueOf(val);
        int j = nos.length();
        int p=0;
        String no = "";
        boolean flag = j>num?false:true;
        for (int i = 0; i < (num-j)&&flag; i++) {
            no+="0";
        }
        for (int i = 0; i < (j-num)&&!flag; i++) {
            p++;
        }
        if(p>0) {
            r = nos.substring(p,p+num);
        }else {
            r = no+nos;
        }
        return r;
    }
    public static void main(String[] args) {
        //整理数据 固定位数的值
        int val = 19999;

        System.out.println(setSquence(val,4));
        String ii = "0012";
        System.out.println(Integer.parseInt(ii));
        String oo = "YY202205160008";
        String substring = oo.substring(10, 14);
        System.out.printf(substring);
    }
}
